package com.ppch.wuwamanus.model.enums;

import cn.hutool.core.util.ObjUtil;
import lombok.Getter;
/**
 * Package:ppch-picture-backend
 * ClassName:UserRoleEnum
 *
 * @Author 泡泡茶壶
 * @Create 2025/8/18 16:55
 * @Version 1.0
 * Description:
 * 消息类型枚举类
 */
@Getter
public enum ChatHistoryMessageTypeEnum {

    USER("用户", "user"),
    AI("AI", "ai"),

    SEND_PDF_FILE("发送PDF文件事件","SEND_PDF_FILE"),

    SEND_CARD_DRAWING_ANALYSIS("发送抽卡分析数据事件","SEND_CARD_DRAWING_ANALYSIS"),

    SEND_ADD_NEW_CONVERSATION("发送新增会话事件","SEND_ADD_NEW_CONVERSATION");

    private final String text;

    private final String value;

    ChatHistoryMessageTypeEnum(String text, String value) {
        this.text = text;
        this.value = value;
    }

    /**
     * 根据 value 获取枚举
     *
     * @param value 枚举值的value
     * @return 枚举值
     */
    public static ChatHistoryMessageTypeEnum getEnumByValue(String value) {
        if (ObjUtil.isEmpty(value)) {
            return null;
        }
        for (ChatHistoryMessageTypeEnum anEnum : ChatHistoryMessageTypeEnum.values()) {
            if (anEnum.value.equals(value)) {
                return anEnum;
            }
        }
        return null;
    }
}
